﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package reprise.controls {
    import flash.events.*;
    import flash.ui.*;

    public class RadioButton extends LabelButton {

        protected var m_groupName:String;

        override public function set isToggleButton(_arg1:Boolean):void{
        }
        override protected function handleKeyEvent(_arg1:KeyboardEvent):Boolean{
            switch (_arg1.keyCode){
                case Keyboard.SPACE:
                    dispatchEvent(new MouseEvent(MouseEvent.CLICK));
                    return (true);
                case Keyboard.LEFT:
                    group().activatePreviousButton(this);
                    return (true);
                case Keyboard.RIGHT:
                    group().activateNextButton(this);
                    return (true);
                default:
                    return (false);
            };
        }
        override public function remove(... _args):void{
            group().removeRadioButton(this);
            super.remove(_args);
        }
        public function setChecked(_arg1:String):void{
            selected = (_arg1 == "checked");
        }
        public function setGroupName(_arg1:String):void{
            if (_arg1 == m_groupName){
                return;
            };
            if (m_groupName){
                group().removeRadioButton(this);
            };
            m_groupName = _arg1;
            group().addRadioButton(this);
        }
        public function groupName():String{
            return (m_groupName);
        }
        override public function setValue(_arg1):void{
            group().selectRadioButtonWithData(_arg1);
        }
        override public function value(){
            return (group().selectedData());
        }
        override public function setName(_arg1:String):void{
            super.setName(_arg1);
            setGroupName(_arg1);
        }
        override public function set selected(_arg1:Boolean):void{
            group().setRadioButtonSelected(this, _arg1);
        }
        override protected function initialize():void{
            super.initialize();
            m_isToggleButton = false;
        }
        override protected function buttonDisplay_click(_arg1:MouseEvent):void{
            if (!m_enabled){
                return;
            };
            super.buttonDisplay_click(_arg1);
            selected = true;
        }
        override public function get selected():Boolean{
            return (m_selected);
        }
        function setSelected(_arg1:Boolean):void{
            if (_arg1){
                activate();
            } else {
                deactivate();
            };
        }
        public function group():RadioButtonGroup{
            return (RadioButtonGroup.groupWithName(m_groupName));
        }

    }
}//package reprise.controls 
